package com.man.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.man.bean.AdminMan;
import com.man.bean.People;
import com.man.dao.AdminDao;
import com.man.dao.PeopleDao;



/**
 * Servlet implementation class RegistServlet
 */
@WebServlet("/editpeoA")
public class EditPeoServlet2 extends HttpServlet {
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		
		String account1 =(String) request.getSession().getAttribute("account");
		String account = (String) request.getSession().getAttribute("account");
		String name = request.getParameter("name");//姓名
		String sex = request.getParameter("sex");//性别
	
		String pros = request.getParameter("pro");//职业
		String clss = request.getParameter("cls");//联系方式

		People people=new People(account,name,sex,pros,clss);
		System.out.println(people.toString());
		int num=new PeopleDao().changePeo(people, account1);
		if(num==1) {
			request.getSession().setAttribute("st", "更改成功");
		
		}else {
			
			request.getSession().setAttribute("st", "更改失败");
			
		}

		request.getRequestDispatcher("pen/editPeo.jsp").forward(request, response);
		
	
	
		
		
	}

}
